package com.buyouchina.web.action.product;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;

import com.buyouchina.bean.product.Record;
import com.buyouchina.service.product.RecordService;
import com.buyouchina.web.action.BaseAction;
import com.opensymphony.xwork2.ModelDriven;

@Controller("RecordAction")
public class RecordAction extends BaseAction implements ModelDriven<Record>{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Record record = new Record();
	@Resource(name="recordServiceBean") private RecordService recordService;
	private List<Record> recordList=new ArrayList<Record>();

	//	查询全部
	public String list(){
		recordList=recordService.getScrollData().getResultlist();
		return SUCCESS;
	}
	
	/**
	 * 		查询某个商品的记录
	 * 
	 * */
	public String findRecord(){
		recordList=recordService.findByPid(record.getProduct().getId());
		record=recordList.get(0);
		return SUCCESS;
	}
	
	public Record getModel() {
		return record;
	}

	public List<Record> getRecordList() {
		return recordList;
	}

	public void setRecordList(List<Record> recordList) {
		this.recordList = recordList;
	}



}
